package com.bedrock.project.inside.api.v1;

import com.bedrock.framework.security.LoginUser;
import com.bedrock.framework.security.service.TokenService;
import com.bedrock.framework.web.controller.BaseController;
import com.bedrock.framework.web.page.TableDataInfo;
import com.bedrock.project.inside.entity.WaitAffair;
import com.bedrock.project.inside.service.IWaitAffairService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * 待办事项Controller
 * 
 * @author bedrock
 * @date 2020-04-08
 */
@RestController
@RequestMapping("/inside/waitAffair")
public class WaitAffairController extends BaseController
{
    @Autowired
    private IWaitAffairService waitAffairService;

    @Autowired
    private TokenService tokenService;

    /**
     * 查询待办事项列表 @PreAuthorize("@ss.hasPermi('inside:waitAffair:list')")
     */

    @ApiOperation("待办事项列表-- wengus")
    @GetMapping("/list")
    public TableDataInfo<WaitAffair> list(HttpServletRequest request)
    {

        LoginUser loginUser = tokenService.getLoginUser(request);
        WaitAffair waitAffair = new WaitAffair();
        waitAffair.setDoUserId(loginUser.getUser().getUserId());
        startPage();
        List<WaitAffair> list = waitAffairService.selectWaitAffairList(waitAffair);
        return getDataTable(list);
    }



//    /**
//     * 获取待办事项详细信息
//     */
//    @PreAuthorize("@ss.hasPermi('inside:waitAffair:query')")
//    @GetMapping(value = "/{id}")
//    public AjaxResult getInfo(@PathVariable("id") Long id)
//    {
//        return AjaxResult.success(waitAffairService.selectWaitAffairById(id));
//    }

//    /**
//     * 新增待办事项
//     */
//    @PreAuthorize("@ss.hasPermi('inside:waitAffair:add')")
//    @Log(title = "待办事项", businessType = BusinessType.INSERT)
//    @PostMapping
//    public AjaxResult add(@RequestBody WaitAffair waitAffair)
//    {
//        return toAjax(waitAffairService.insertWaitAffair(waitAffair));
//    }

//    /**
//     * 修改待办事项
//     */
//    @PreAuthorize("@ss.hasPermi('inside:waitAffair:edit')")
//    @Log(title = "待办事项", businessType = BusinessType.UPDATE)
//    @PutMapping
//    public AjaxResult edit(@RequestBody WaitAffair waitAffair)
//    {
//        return toAjax(waitAffairService.updateWaitAffair(waitAffair));
//    }

//    /**
//     * 删除待办事项
//     */
//    @PreAuthorize("@ss.hasPermi('inside:waitAffair:remove')")
//    @Log(title = "待办事项", businessType = BusinessType.DELETE)
//	@DeleteMapping("/{ids}")
//    public AjaxResult remove(@PathVariable Long[] ids)
//    {
//        return toAjax(waitAffairService.deleteWaitAffairByIds(ids));
//    }
}
